package com.pl.itsense.gwt.clientzone.model;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Member {
		private Long id;
		private int role;
		private String login;
		private String password;
		private String email;
		private String firstName;
		private String lastName;
		private String company;
		private String phone;
		private Boolean newsletter;
		private String comment;
		private String intrests;
		private Boolean active;
		private String registrationHash;
		

		public void setActive(Boolean active) {
			this.active = active;
		}
		
		public Boolean getActive() {
			return active;
		}
		
		public String getRegistrationHash() {
			return registrationHash;
		}
		
		public void setRegistrationHash(String registrationHash) {
			this.registrationHash = registrationHash;
		}
		
		public void setCompany(String company) {
			this.company = company;
		}
		
		public String getCompany() {
			return company;
		}
		
		
		public void setIntrests(String intrests) {
			this.intrests = intrests;
		}
		public String getIntrests() {
			return intrests;
		}
		
		public void setComment(String comment) {
			this.comment = comment;
		}
		public String getComment() {
			return comment;
		}
		
		public void setNewsletter(Boolean newsletter) {
			this.newsletter = newsletter;
		}
		
		public Boolean getNewsletter() {
			return newsletter;
		}
		
		public void setPhone(String phone) {
			this.phone = phone;
		}
		
		public String getPhone() {
			return phone;
		}
		
		
		public Member() {
		}
		public int getRole() {
			return role;
		}
		public void setRole(int role) {
			this.role = role;
		}
		public Member(MemberDTO memberDTO) {
			company = memberDTO.getCompany();
			id = memberDTO.getId();
			comment = memberDTO.getComment();
			intrests = memberDTO.getIntrests();
			newsletter = memberDTO.getNewsletter();
			phone = memberDTO.getPhone();
			email = memberDTO.getEmail();
			firstName = memberDTO.getFirstName();
			lastName = memberDTO.getLastName();
			password = memberDTO.getPassword();
			login = memberDTO.getLogin();
			role = memberDTO.getRole();
		}
		
		
		@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
		public Long getId() {
			return id;
		}
		
		
		
		public void setId(Long id) {
			this.id = id;
		}
		
			public String getLogin() {
			return login;
		}
		
		public void setLogin(String login) {
			this.login = login;
		}
		
		public String getPassword() {
			return password;
		}
		
		public void setPassword(String password) {
			this.password = password;
		}
		
		public String getEmail() {
			return email;
		}
		
		public void setEmail(String email) {
			this.email = email;
		}
		
		public String getFirstName() {
			return firstName;
		}
		
		public void setFirstName(String firstName) {
			this.firstName = firstName;
		}
		
		public String getLastName() {
			return lastName;
		}
		
		public void setLastName(String lastName) {
			this.lastName = lastName;
		}
		
		@Override
		public String toString() {
			String result = "";
			if (id != null) result += id;
			if (login != null) result += login;
			if (email != null) result += email;
			if (firstName != null) result += firstName;
			if (lastName != null) result += lastName;
			if (phone != null) result += phone;
			return result;
		}

}
